﻿<Window x:Class="Kolhoz.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:gameViewModel="clr-namespace:GameViewModel;assembly=GameViewModel"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
        Title="MainWindow" Height="775" Width="744" d:DataContext="{gameViewModel:TheGame}">
    <Window.Resources>
        <DataTemplate x:Key="PersonTemplate" DataType="gameViewModel:Person">
            <StackPanel Margin="10 10 10 10" Orientation="Horizontal">
                <CheckBox IsChecked="{Binding Path=IsSelected}"/>
                <TextBlock Text=" "/>
                <TextBlock FontWeight="bold" Text="{Binding Path=Name}"/>
            </StackPanel>
        </DataTemplate>
        <DataTemplate x:Key="PlayerTemplate" DataType="gameViewModel:Player">
            <StackPanel>
                <StackPanel Margin="10 10 10 10" Orientation="Horizontal" VerticalAlignment="Center">
                    <TextBlock Text="{Binding Path=Order}" VerticalAlignment="Center"/>
                    <TextBlock Text=". " VerticalAlignment="Center"/>
                    <TextBlock FontWeight="bold" Text="{Binding Path=Name}" VerticalAlignment="Center"/>
                    <TextBlock Text="   "/>
                    <TextBlock FontWeight="bold" FontSize="24" Text="{Binding Path=PlayerScore}" VerticalAlignment="Center"/>
                </StackPanel>
                <StackPanel Margin="10 0 10 5" Orientation="Horizontal" VerticalAlignment="Center">
                    <Button Name="PlayerPlus" Width="20" Tag="{Binding Path=.}" Click="PlayerPlus_OnClick" VerticalAlignment="Center">+</Button>
                    <Button Name="PlayerMinus" Width="20" Tag="{Binding Path=.}" Click="PlayerMinus_OnClick" VerticalAlignment="Center">-</Button>
                    <Button Name="PlayerPenalty" Tag="{Binding Path=.}" Click="PlayerPenalty_OnClick" VerticalAlignment="Center">Штраф</Button>
                </StackPanel>
            </StackPanel>
        </DataTemplate>
    </Window.Resources>
    <StackPanel Margin="10 10 10 10" >
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBox Grid.Column="0" Name="NewPlayerNameTextBox"></TextBox>
            <Button Grid.Column="1" Name="CreateUserBtn" Click="CreateUserBtn_OnClick">Добавить игрока</Button>
        </Grid>
        <ListBox ItemsSource="{Binding Path=Options.Persons}" ItemTemplate="{StaticResource PersonTemplate}"></ListBox>
        <Separator Background="DarkBlue" Height="5"></Separator>
        <StackPanel Orientation="Horizontal" Margin="5 5 5 5">
            <TextBlock FontWeight="bold" Text="Игровые единицы: "/>
            <TextBox Text="{Binding Path=Unit}" Width="50" ></TextBox>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Margin="5 5 5 5">
            <CheckBox IsChecked="{Binding Options.IsRandomOrder}" VerticalAlignment="Center">Распределить игроков случайным образом</CheckBox>
            <Button Name="StartGameBtn" Margin="10 0 0 0" IsEnabled="{Binding Path=Options.IsStartAvailable}" Click="StartGame_OnClick">Начать</Button>
        </StackPanel>
        <Separator Background="DarkBlue" Height="5"></Separator>
        <StackPanel Orientation="Horizontal">
            <TextBlock FontWeight="bold" Text="Бонус: "/>
            <TextBlock FontWeight="bold" Text="{Binding Path=BonusScore}"/>
        </StackPanel>
        <ListBox ItemsSource="{Binding Path=Players}" ItemTemplate="{StaticResource PlayerTemplate}"></ListBox>
    </StackPanel>
</Window>
